#include "widget.h"
#include "ui_widget.h"
//#include "mylable.h"
//#include <QLabel>
#include <QLineEdit>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    connect(ui->pushButton, &QPushButton::clicked, this, &Widget::handleClick);
//    QLineEdit* edit = new QLineEdit(thi s);
//    edit->setText("hello world");
//    MyLable* label = new MyLable(this);
//    label->setText("helloworld");
//    QLabel* label = new QLabel(this);
//    QString string = "hello world";
//    label->setText("hello world");
//    QLabel label;
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleClick()
{
    // 当按钮被点击之后，就把按钮中的文本，进行切换
    if(ui->pushButton->text() == QString("hello world"))
    {
        ui->pushButton->setText("hello qt");
    }
    else
    {
        ui->pushButton->setText("hello world");
    }

}

